package pikes.peak;

import java.util.Map;

import org.springframework.web.servlet.support.RequestContext;

import pikes.html.xhtml.Inline;
import pikes.html.xhtml.PCData;

public interface ObjectFormatter<T> {

	ObjectFormatter TOSTRINGFORMATTER = new ObjectFormatter<Object>() {

		public Inline getLabel(Object object, Map model, RequestContext requestContext) throws Exception {
			return new PCData(object.toString());
		}

		public CharSequence getValue(Object object, Map model, RequestContext requestContext) throws Exception {
			return object.toString();
		}

	};

	CharSequence getValue(T object, Map model, RequestContext requestContext) throws Exception;

	Inline getLabel(T object, Map model, RequestContext requestContext) throws Exception;
}
